<?php
// 本类由系统自动生成，仅供测试用途
class SermonAction extends Action {
	public function index(){
		$Article = M("Article");
		$condition['article_type_name'] = sermon;
		$Sermon=$Article->where($condition)->order('article_id desc')->select();
		$this->assign('Sermon',$Sermon);
		
		// 查询首页见证分享
		$Article = M("Article");
		$condition['article_type_name'] = witness;
		$Witness=$Article->where($condition)->limit(5)->order('article_id desc')->select();
		$this->assign('Witness',$Witness);
		
		// 查询新闻
		$Article = M("Article");
		$condition['article_type_name'] = news;
		$News=$Article->where($condition)->limit(5)->order('article_id desc')->select();
		$this->assign('News',$News);
		
		// 查询首页信仰需知
		$Article = M("Article");
		$condition['article_type_name'] = faith;
		$Faith=$Article->where($condition)->limit(5)->order('article_id desc')->select();
		$this->assign('Faith',$Faith);
		
		// 查询首页祷告
		$Pray = M("Pray");
		$td_pray=$Pray->limit(3)->order('pray_id desc')->select();
		$this->assign('td_pray',$td_pray);
		
		// 查询首页公告
		$notice=M("notice");
		$list2 = $notice->limit(3)->order('notice_id desc')->select();
		$this->assign("list2",$list2);
		
		$this->display();
	}

	public function detial(){
		$a_id = $_GET["_URL_"][2];
		$Article = M("Article");
		$condition['article_id'] = $a_id;
		$SermonD=$Article->where($condition)->find();
		$this->assign('SermonD',$SermonD);
		
		// 查询首页公告
		$notice=M("notice");
		$list2 = $notice->limit(3)->order('notice_id desc')->select();
		$this->assign("list2",$list2);
		
		// 查询新闻
		$Article = M("Article");
		$condition['article_type_name'] = news;
		$News=$Article->where($condition)->limit(4)->order('article_id desc')->select();
		$this->assign('News',$News);
		
		// 查询首页见证分享
		$Article = M("Article");
		$condition['article_type_name'] = witness;
		$Witness=$Article->where($condition)->limit(5)->order('article_id desc')->select();
		$this->assign('Witness',$Witness);
		
		$this->display();
	}
}
?>